#coding=utf-8
goods =[{"name":"电脑","price":1999},
        {"name":"鼠标","price":10},
        {"name":"显示器","price":120},
        {"name":"内存","price":230},]
by=[]

for a,b in enumerate(goods):
    by.append([b["name"],b["price"]])
for c,d in enumerate(by):
    c=c+1
    print(c,d[0],d[1])
while True:
    put=input("请选择商品，输入Q或者q退出")
    if put.isdigit():
        put=int(put)
        if put>len(goods):
            print("请输入商品编号")
        else:
            print(by[put-1])
            break
    elif put=="q"or put=="Q":
        break
    else:
        print("请输入正确的编号")